package com.foreknow.elm.service.impl;

import com.foreknow.elm.dao.BusinessDao;
import com.foreknow.elm.dao.impl.BusinessDaoImpl;
import com.foreknow.elm.po.Business;
import com.foreknow.elm.service.BusinessService;
import com.foreknow.elm.util.DBUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 啊滨
 * @date 2023/2/13 16:37
 */
public class BusinessServiceImpl implements BusinessService {
    @Override
    public List<Business> listBusinessByOrderTypeId(int orderTypeId) {
        List<Business> list=new ArrayList<>();
        try {
            BusinessDao businessDao=new BusinessDaoImpl();
            DBUtil.getConnection();
            list = businessDao.listBusinessByOrderTypeId(orderTypeId);
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            DBUtil.close();
        }
        return list;
    }

    @Override
    public Business getBusinessById(int businessId) {
            Business business=new Business();
        try {
            BusinessDao businessDao=new BusinessDaoImpl();
            DBUtil.getConnection();
            business = businessDao.getBusinessById(businessId);
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            DBUtil.close();
        }
        return business;
    }
}
